package com.controller;

import com.service.IPlaceService;
import com.vo.placeVo.PlaceListRequestVo;
import com.vo.placeVo.PlaceListResponseVo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @Describe 地址管理控制器
 */
@Controller
@RequestMapping("/place")
public class PlaceController {
    @Resource
    IPlaceService placeService;
    @Resource
    HttpServletRequest request;

    /**
     * 获取地址信息列表
     * @return
     */
    @RequestMapping("/getPlaceList")
    @ResponseBody
    public List<PlaceListResponseVo> getPlaceList(PlaceListRequestVo vo){
        Object session= request.getSession().getAttribute("user");
        if(session != null) {
            return placeService.getPlaceList(vo);
        }
        return null;
    }
}
